<template>
	<view style="height: 100vh; background-color: #FFFFFF;">
		<u-navbar title-color="#FFFFFF" height="48" back-icon-color="#FFFFFF" :border-bottom="false" :is-fixed="true"
			title="消防隐患详情"></u-navbar>
		<uc-content :loading="loading">
			<view class="list-item" v-if="abnormalPic">
				<view class="list-img">
					<view class="text">隐患图片:</view>
					<view class="img">
						<u-image width="50%" height="450rpx" :src="abnormalPic"></u-image>
					</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>隐患名称:</view>
					<view>{{hiddenDangerInfo.name}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>执行时间:</view>
					<view>{{hiddenDangerInfo.executeTime | dateFormat}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>隐患描述:</view>
					<view>{{hiddenDangerInfo.remark}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>所属区域:</view>
					<view>{{hiddenDangerInfo.regionName}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>隐患地点:</view>
					<view>{{hiddenDangerInfo.address}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>当前状态:</view>
					<view class="u-type-success">{{hiddenDangerInfo.statusStr}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-bottom">
					<view>整改期限:</view>
					<view>{{hiddenDangerInfo.deadline | dateFormat}}</view>
				</view>
			</view>
			<view class="list-item" v-if="hiddenDangerInfo.status === 12">
				<view class="list-bottom">
					<view>申请整改时间:</view>
					<view>{{hiddenDangerInfo.examineTime | dateFormat}}</view>
				</view>
			</view>
			<view class="list-item">
				<view class="list-img">
					<view class="text">完成图片:</view>
					<view class="img">
						<u-image width="50%" height="450rpx"
							:src="completeUrl+'?x-oss-process=style/zip_app'" mode="aspectFit">
							<u-loading slot="loading"></u-loading>
						</u-image>
					</view>
				</view>
			</view>
		</uc-content>
	</view>
</template>


<script>
	export default {
		data() {
			return {
				hiddenDangerInfo: {},
				fileList: [],
				loading: false,
				hidden: false,
				hidden1: true,
				abnormalPic: null,
				completeUrl: null
			}
		},
		onLoad(e) {
			this.ucId = e.ucId
		},
		onShow() {
			this.initViews()
		},
		methods: {
			initViews() {
				this.loading = true
				this.getInHiddenDanger(this.ucId)
			},
			getInHiddenDanger(val) {
				this.utils.request("/api/app/inHiddenDanger/getInHiddenDanger", {
					ucId: val
				}, "post", "app", true).then(res => {
					this.loading = false
					this.hiddenDangerInfo = res.data
					if (this.completeUrl == null) {
						this.completeUrl = this.hiddenDangerInfo.completeUrl
					}
					if (this.hiddenDangerInfo.abnormalPic != null) {
						this.abnormalPic = this.hiddenDangerInfo.abnormalPic
					}
				}).catch(error => {
					this.loading = false
					console.log(error)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import "../../../uview-ui/libs/css/style.components.scss";

	.list-item {
		padding: 20rpx 40rpx;
		background-color: #fff;
		border-bottom: #999999 1px dashed;

		.list-bottom {
			display: flex;
			margin-top: 10rpx;
			font-size: 28rpx;
			justify-content: space-between;
			color: #333;
		}

		.list-center {
			margin-top: 20rpx;
			font-size: 28rpx;
			color: #999999;
		}

		.list-img {
			display: flex;
			margin-top: 10rpx;
			font-size: 28rpx;
			color: #333;

			.text {
				flex: 1;
			}

			.img {
				flex: 3;
			}
		}
	}

	.btn {
		width: 99%;
		margin-top: 3px;
	}
</style>
